var express = require('express');
var router = express.Router();
var passport=require('passport')
var userController = require('../controllers/userControllers')

// 短信发送
router.get('/getVCode', function (req, res, next) {
  userController.getvCode(req, res)
})
//短信验证
router.get('/msgCheck',function(req,res,next){
   userController.msgCheck(req,res)
})

// 登录
router.post('/login', function (req, res, next) {
  userController.login(req, res)
});

//注册
router.post('/register', function (req, res, next) {
  userController.register(req, res)
})
//修改个人信息
// passport.authenticate('jwt',{session:false}),
router.put('/updateUserInfos/:userId', function (req, res, next) {
  userController.changeUserInfos(req, res)
})
//修改密码
router.put('/changePsw/:phone', function (req, res, next) {
  userController.changePsw(req, res)
})

//上传头像
router.post('/headPic',function (req, res, next) {
  userController.uploadPic(req, res)
})
// 个人中心
router.get('/:tel',function (req, res, next) {
  userController.getUsersDetail(req, res)
});
module.exports = router;
